//https://leetcode.cn/problems/container-with-most-water/description/

class Solution {
public:
    int maxArea(vector<int>& height) {
        int left = 0;
        int right = height.size() - 1;
        int ret = 0;
        while (left < right) {
            int x = min(height[left], height[right]) * (right - left);
            ret = max(x, ret);
            if (height[left] <= height[right]) {
                ++left;
            }
            else {
                --right;
            }
        }
        return ret;
    }
};